package com.walle.concurrenttest;

import com.hongdaoai.datastore.dao.service.IDataCenterService;

/**
 * @author zhangjiapeng
 * @Package com.walle.concurrenttest
 * @Description: ${todo}
 * @date 2019/2/18 9:49
 */
public class Bank {


    private int money;

    private String name;

    private IDataCenterService dataCenterService;
    public Bank(int money, String name) {
        this.money = money;
        this.name = name;
    }

    public synchronized void desposit(int m){
        money = money + m;
    }

    public synchronized boolean withdraw(int m){
        if(money > m){
            money = money - m;
            return  true;
        }
        return  false;
    }

    public String getName() {
        return name;
    }
}
